package com.coolingme.algo_01_list;

import com.coolingme.algo_01_list.addtwolist.ListNode;

/**
 * 链表节点复制，保存头结点
 *
 * @author wangyue
 * @date 2020/11/5 16:20
 */
public class ListNodeTest {

    public static void main(String[] args) {
        /*
        1 => 2
        1 => 2
        2

        1 => 2 => 3
        2 => 3
        3
         */
        ListNode head = new ListNode(1);
        ListNode pre = head;

        ListNode node2 = new ListNode(2);
        pre.next = node2;
        System.out.println(head);
        System.out.println(pre);
        pre = pre.next;
        System.out.println(pre);

        System.out.println("--------");

        pre.next = new ListNode(3);
        System.out.println(head);
        System.out.println(pre);
        pre = pre.next;
        System.out.println(pre);
    }

}
